package org.dtrd.modules.evaluation.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdNephropathy;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdNeuropathy;

import java.util.Date;

/**
 * @Author: QR
 * @Date: 2021/9/28-10:23
 */
@ApiModel("疾病估量表信息")
@Data
public class DiseaseEvaluationInfo {

    private Integer dataId;

    @ApiModelProperty(value = "患者ID")
    private Integer patientId;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "是否确诊：1-未确诊,2-已确诊,3-确诊无,<br>糖尿病视网膜病变评估有4-妊娠妇女")
    private Integer isDiagnose;

    @ApiModelProperty(value = "症状或检查")
    private Integer[] symptom;

    @ApiModelProperty(value = "输出内容")
    private String output;

    public <T extends GetDiseaseEvaluationInfo> DiseaseEvaluationInfo parseFromPo(T po){
        this.setDataId(po.getDataId());
        this.setPatientId(po.getPatientId());
        this.setCreateTime(po.getCreateTime());
        this.setIsDiagnose(po.getIsDiagnose());
        this.setOutput(po.getOutput());
        // 转换成数字数组
        String[] symptomStrings = po.getSymptom().split(",");
        Integer[] symptom = new Integer[symptomStrings.length];
        for (int i = 0; i < symptomStrings.length; i++) {
            symptom[i] = Integer.parseInt(symptomStrings[i]);
        }
        this.setSymptom(symptom);
        return this;
    }
}
